<?php

/**
 * this class builds the uri object that the site uses
 *
 */
class Dig_Uri
{
    public $uri;
    public $params = array();
    
    const DEFAULT_SEPARATOR = 'p';
    /**
     * this method returns the current uri
     *
     */
    public static function toString()
    {
        return $_SERVER['REQUEST_URI'];
    }
    
    public static function stripParams($uri, $separator = null)
    {
        if($separator == null) {
            $separator = self::DEFAULT_SEPARATOR;
        }
        
    }
    
    public static function factory($uri, $separator = null)
    {
        if($separator == null) {
            $separator = self::DEFAULT_SEPARATOR;
        }
        $uriParts = Dig_Util_Array::splitOnValue(explode('/', $uri), $separator);
        $uriObject = new self();
        if(is_array($uriParts)) {
            $uriObject->uri = implode('/', $uriParts[0]);
            $uriObject->params = Dig_Util_Array::makeHashFromArray($uriParts[1]);
        } else {
            $uriObject->uri = $uri;
        }
        return $uriObject;
    }

}